//
//  Terrain.h
//  CompGraf2
//
//  Created by Juan Niosi on 05/09/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#define HOLE 0
#define FLOOR 1

#import "Entity.h"
#import "MapNode.h"
#import "Vector3.h"
#import "QuadNode.h"
@interface Terrain : Entity
{
    int *terrainData;
    int width;
    int height;
    GLfloat tileWidth;
    GLfloat zheight;
    GLfloat xOffset;
    GLfloat yOffset;
    QuadNode *root;
    
}
@property (nonatomic) int width;
@property (nonatomic) int height;

- (id)init:(NSString *)filename engine:(Engine *)engine;

- (NSArray *)getPath:(MapNode*)initial:(MapNode*)final;
- (NSArray *)getAdjacents:(MapNode*)node finalNode:(MapNode *)final;

- (GLfloat *)posToCoords:(int)x:(int)y;
- (void)drawPath:(NSArray *)path withEngine:(Engine *)engine;
- (Vector3 *)mapNode2vert:(MapNode *)pn;
- (MapNode *)vert2MapNode:(Vector3 *)vec;
- (BOOL)nodeInArray:(NSArray *)array:(MapNode *)node;
- (void)insertOrdenado:(NSMutableArray *)array:(MapNode *)nodo;

- (BOOL)isOccupied:(int)x:(int)y;
@end
